package net.starwifi.duobao.template.directive;

import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import net.starwifi.duobao.utils.FreemarkerUtils;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.Writer;
import java.util.Map;

/**
 * 通过模板指令调用css,js压缩后的路径
 * Created by Administrator on 2015/12/12.
 */
@Component("compressorDirective")
public class CompressorResourceDirective extends BaseDirective  {

    /** key:/statics/view/js/db_index.js */
    private static final String KEY = "key";

    @Override
    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
        String key = FreemarkerUtils.getParameter(KEY, String.class, params);
        Writer out = env.getOut();
        out.write("");
    }
}
